import http from '@/apis/index';
import useUserStore from '@/stores/user';
import useAppStore from '@/stores/app';

/**
 * 登录
 * @param {String} username 
 * @param {String} password 
 * @returns 
 */
export const login = async (username, password) => {
    let { data } = await http.post('/authorize/login', {
        username,
        password
    });
    useUserStore().login(data);
    useAppStore().$reset();
    return data;
};